﻿using System;
using System.IO.IsolatedStorage;

namespace SlXnaApp1.Model
{
    public class Settings
    {
        public static void Init()
        {
            var settings = IsolatedStorageSettings.ApplicationSettings;
            if (settings.Count == 0) CreateDefaultSettings(settings);
        }

        private static void CreateDefaultSettings(IsolatedStorageSettings settings)
        {
            settings.Add("Default user name", "Player");
        }

        public static string GetDefaultUserName()
        {
            var settings = IsolatedStorageSettings.ApplicationSettings;
            return (String)settings["Default user name"];
        }

        public static void SetDefaultUserName(string name)
        {
            var settings = IsolatedStorageSettings.ApplicationSettings;
            settings["Default user name"] = name;
        }

        public static void ToDefaultSettings()
        {
            var settings = IsolatedStorageSettings.ApplicationSettings;
            settings.Clear();
            CreateDefaultSettings(settings);
        }
   
    }
   
}
